# author = '李天宝'
# write in '2020/8/5 0005 16:15'

from rest_framework.views import APIView
from products.models import goods_category
from rest_framework.response import Response

class Categorys(APIView):
    """
    get
    不用携带任何参数
    这个是用于返回所有的分类的id和名称
    """
    def get(self,request):
        categroys=goods_category.objects.all()[:15]
        return Response({
            'code':200,
            'detail':categroys.values('id','category_name')
        })